package com.yanceysong.codetop.s91_s100;

import com.yanceysong.common.TreeNode;

/**
 * S93_Easy_226_翻转二叉树
 * <p>
 * https://leetcode.cn/problems/invert-binary-tree/
 * <p>
 * 给你一棵二叉树的根节点 root ，翻转这棵二叉树，并返回其根节点。
 */
public class S93_Easy_226_翻转二叉树 {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);
        root.left = right;
        root.right = left;
        return root;
    }
}

